<?
	$who = $_SESSION['userid'];
	$sql = "SELECT * FROM ".$pre."_users WHERE userNumber = '".$who."'";
	$res = mysql_query($sql);
	if($res)$rows = mysql_num_rows($res);else exit;
	if($rows > 0){		
		$data = mysql_fetch_object($res);
		$datalist = array($data->uName,$data->fName,$data->lName,$data->uEmail,$data->uPhone,$data->showfName,$data->showlName,$data->showuEmail,$data->showuPhone);
		$j=0;
		for($i=5;$i<=8;$i++){
			if($datalist[$i]==1)$checked[$j]='checked="checked"';else $checked[$j]='';
			$j++;
		}
	}else exit;	
?>

<div style="float:left;width:500px;margin-top:20px;">
<form action="" method="post" name="profileedit">
<fieldset>
<legend>Personal data</legend>
<table>
<tr>
<td><label for="profile_name">Name</label><input type="text" name="profile_name" id="profile_name" value="<?=$datalist[0]?>"/></td>
<td><label for="profile_fname">First Name</label><input type="text" name="profile_fname" id="profile_fname" value="<?=$datalist[1]?>" /></td>
</tr>
<tr>
<td colspan="2"><label for="profile_email">Email </label><input type="text" name="profile_email" id="profile_email" value="<?=$datalist[3]?>"/></td>
</tr>
<tr>
<td colspan="2"><label for="profile_phone">Phone</label><input type="text" name="profile_phone" id="profile_phone" value="<?=$datalist[4]?>"/></td>
</tr>
</table>
</fieldset>
<fieldset>
<legend>Profile Settings</legend>
<table>
<tr>
<td><label for="profile_flag01">Show First Name</label><input name="profile_flag01" id="profile_flag01" type="checkbox" <?=$checked[0]?> value="1"></td>
</tr>
<tr>
<td><label for="profile_flag02">Show Account Name</label><input name="profile_flag01" id="profile_flag02" type="checkbox" <?=$checked[1]?> value="1"></td>
</tr>
<tr>
<td><label for="profile_flag03">Show Email</label><input name="profile_flag01" id="profile_flag03" type="checkbox" <?=$checked[2]?> value="1"></td>
</tr>
<tr>
<td><label for="profile_flag04">Show Phone</label><input name="profile_flag01" id="profile_flag04" type="checkbox" <?=$checked[3]?> value="1"></td>
</tr>
</table>
</fieldset>
<div id="profile_process"></div>
<input type="submit" value="Save" name="save"/>
</form>
</div>